/**
 * 
 */
package com.kovell.profileo.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author SOSSERES
 *
 */
@MappedSuperclass
public class BaseEntity implements Serializable {

	@Id
	@Column(name="ROW_ID", unique=true, nullable=false)
	private String id;
	
	@Column(name="CREATED_BY")
	private String createdBy;
	
	@Column(name="CREATED")
	@Temporal(TemporalType.TIMESTAMP)
	private Date created;

	@Column(name="MODIFIED_BY")
	private String modifiedBy;
	
	@Column(name="MODIFIED")
	@Temporal(TemporalType.TIMESTAMP)
	private Date modified;
	
	/**
	 * 
	 */
	public BaseEntity() {
		String[] ss = UUID.randomUUID().toString().split("-");
		this.id = ss[1] + ss[3];
		
		this.created = new Date();
		this.createdBy = "SYSADMIN";
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public String getModifiedBy() {
		return modifiedBy;
	}

	public void setModifiedBy(String modifiedBy) {
		this.modifiedBy = modifiedBy;
	}

	public Date getModified() {
		return modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}
}
